package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.vo.Approval.ApprovalManagement.ApprovalManagementVO;
import com.ruoyi.system.domain.vo.Approval.ApprovalManagement.Apporver;
import com.ruoyi.system.mapper.ApprovalManagementMapper;
import com.ruoyi.system.service.IApprovalManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ApprovalManagementImpl implements IApprovalManagementService {

    @Autowired
    private ApprovalManagementMapper approvalManagementMapper;

    @Override
    public List<ApprovalManagementVO> getApprovalList(String status, String typeName) {
        Long approverId = SecurityUtils.getLoginUser().getUserId();
        System.out.println("用户ID:"+ approverId);
        return approvalManagementMapper.selectApprovalList(status, typeName,approverId);
    }

    @Override
    public Integer agree(int id) {
        return approvalManagementMapper.agree(id);
    }

    @Override
    public Integer refuse(int id) {
        return approvalManagementMapper.refuse(id);
    }

    @Override
    public Integer transfer(int id, int nextId) {
        return approvalManagementMapper.transfer(id, nextId);
    }

    @Override
    public List<Apporver> selectApprovers() {
        return approvalManagementMapper.selectApprovers();
    }
}
